subroutine r2abij_t2efij_iefab_g(r2, t2, &
              iabcd, icore, fact)
!
use mod_iop
use mod_size
use mod_orbit
use mod_ioff 
implicit none
!
real*8, intent(in) :: fact
real*4, intent(in) :: iabcd(*)
real*4, intent(in),device :: r2(*)
!
real*4, intent(inout),device :: t2(*), icore(*)
!
integer :: i, j, a, b, nsize, i0, i1, i2, i3, i4
real*8, external ::nrm2so, dnrm2
integer, external :: idsymsoc
!this is to do r2 = r2 + 0.5*t2(efij)*iefab
i0 = 1
i1 = i0 + nvvoo*isd
i2 = i1 + nvvoo*isd     ! tmp+
i3 = i2 + nvvoo*isd     ! tmp-
i4 = i3 + nvvoo*isd     ! icore 
!call printdnrm2('iabcd', iabcd, 6)
! ABAB
call iassymso(t2, icore(i1), 1, vrta, vrta, popa, popa, 1)
call icompso(icore(i1), icore(i0), vrta, vrta, 1, 0, popa, popa, 0, 1, 1)
!nsize = idsymsoc(1, vrta, vrta, 0, popa, popa, 0)
!write(6,*)'norm of t-', nrm2so(nsize, icore(i0), 1)
! t+
call isymtrso(t2, icore(i1), vrta, vrta, 1, 1, popa, popa, 1, 0, 1)
nsize = idsymsoc(1, vrta, vrta, 1, popa, popa, 1)
call axpyso(nsize, 1.d0, t2, 1, icore(i1), 1)
call icompso(icore(i1), icore(i2), vrta, vrta, 1, 2, popa, popa, 1, 1, 1)
call icompso(icore(i2), icore(i1), vrta, vrta, 2, 1, popa, popa, 1, 2, 1)
!nsize = idsymsoc(1, vrta, vrta, 2, popa, popa, 2)
!write(6,*)'norm of t+', nrm2so(nsize, icore(i1), 1)
!--------  t-*abcd-
 call VpqmnVmnrs_to_Vpqrs_large_g(icore(i4), icore(i0), 1, 1, vrta, vrta, 0, &
                 vrta, vrta, 0, popa, popa, 0, icore(i2), 1, 0.5d0, 0.d0, & 
                 iabcd(ioi6(1)))
!nsize = idsymsoc(1, vrta, vrta, 0, popa, popa, 0)
!write(6,*)'norm of tmp abcd 1', nrm2so(nsize, icore(i2), 1)
!nsize = idsymsoc(1, vrta, vrta, 0, popa, popa, 0)
!write(6,*)'norm of t-', nrm2so(nsize, icore(i0), 1)
!nsize = idsymsoc(1, vrta, vrta, 0, vrt, vrt, 0)
!call myicopy_g(iabcd(ioi6(1)), icore(i4), nsize)
!call VpqmnVmnrs_to_Vpqrs(icore(i4), icore(i0), 1, 1, vrta, vrta, 0, &
!                 vrta, vrta, 0, popa, popa, 0, icore(i2), 1, 0.5d0, 0.d0)
!nsize = idsymsoc(1, vrta, vrta, 0, popa, popa, 0)
!write(6,*)'norm of tmp abcd 1', nrm2so(nsize, icore(i2), 1)

!--------  t+*abcd+
call VpqmnVmnrs_to_Vpqrs_large_g(icore(i4), icore(i1), 1, 1, vrta, vrta, 2, &
                 vrta, vrta, 2, popa, popa, 2, icore(i3), 1, 0.5d0, 0.d0, &
                 iabcd(ioi6(2)))
!nsize = idsymsoc(1, vrta, vrta, 2, popa, popa, 2)
!write(6,*)'norm of tmp abcd 2', nrm2so(nsize, icore(i3), 1)

!-------expand r-  to icore(i0)
call iexpso(icore(i2), icore(i1), vrta, vrta, 0, 1, popa, popa, 0, 0, 1)
call iexpso(icore(i1), icore(i0), vrta, vrta, 1, 0, popa, popa, 0, 1, 1)
! nsize = idsymsoc(1, vrta, vrta, 1, popa, popa, 1)
! write(6,*)'norm of test abcd 1', nrm2so(nsize, icore(i0), 1)

!-------expand r+  to icore(i1)                                       
call iexpso(icore(i3), icore(i2), vrta, vrta, 2, 0, popa, popa, 2, 1, 1)
call iexpso(icore(i2), icore(i1), vrta, vrta, 2, 1, popa, popa, 1, 0, 1)
!nsize = idsymsoc(1, vrta, vrta, 1, popa, popa, 1)
!write(6,*)'norm of test abcd 2', nrm2so(nsize, icore(i1), 1)
! t- + t+
nsize = idsymsoc(1, vrta, vrta, 1, popa, popa, 1)
call axpyso(nsize, 1.d0, icore(i1), 1, icore(i0), 1)
!nsize = idsymsoc(1, vrta, vrta, 1, popa, popa, 1)
!write(6,*)'norm of test abcd', nrm2so(nsize, icore(i0), 1)
!
call axpyso(nioi32, fact*2.d0, icore(i0), 1, r2(ioi3(2)), 1)
!
return
end
